﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ninject;
using PraiseSystem.Domain.Abstract;
using PraiseSystem.Domain.Concrete.EFRepositories;


namespace PraiseSystem.WebUI.Infrastructrue
{
    public class NinjectDependencyResolver:IDependencyResolver
    {
        private IKernel kernel;
        public NinjectDependencyResolver(IKernel kernelParam)
        {
            kernel = kernelParam;
            AddBindings();
        }

        public object GetService(Type serviceType)
        {
            return kernel.Get(serviceType);
        }

        public IEnumerable<object> GetServices(Type serviceType)
        {
            return kernel.GetAll(serviceType);
        }

        public void AddBindings()
        {
            kernel.Bind<IUserRepository>().To<EFUserRepository>();
            kernel.Bind<IReceiverRepository>().To<EFReceiverRepository>();
            kernel.Bind<IPraiseRepository>().To<EFPraiseRepository>();
        }
    }
}